<#assign module="marketing"/>

<@override name="header">
<link rel="stylesheet" href="${ctx}/assets/css/form.css">
</@override>
<@override name="body">

	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-default">
				<div class="panel-heading">
					客户推荐提成
			    </div>
			    <div class="panel-body">
    				<form id="submit_form" action="${ctx}/memberrebate/update" class="form-horizontal" method="post">
		                
		                <input type="hidden" name="id" value="${rebate.id?if_exists}">
		                
		                <div class="form-group">
		                	<label class="col-sm-2 control-label"></label>
		                    <label class="col-sm-2 control-label"></label>
		                    <div class="col-sm-8">
		                    	<p class="form-control-static"><font color="red">注：不使用提成则设置为0或不填，一级提成指当前事件用户的推荐人。</font></p>
		                    </div>
		                </div>
		                
		                <div class="form-group">
		                	<label class="col-sm-2 control-label"></label>
		                    <label class="col-sm-2 control-label"><em>*</em>提成类型：</label>
		                    <div class="col-sm-8">
		                    	<p class="form-control-static">
		                    		<label style="padding-right:30px;">
										<input type="radio" name="type" value="0" <#if rebate.type?? && rebate.type==0>checked="checked"</#if>> 一次性提成
									</label>
									<label style="padding-right:30px;">
										<input type="radio" name="type" value="1" <#if rebate.type?? && rebate.type==1>checked="checked"</#if>> 按单提成
									</label>
								</p>
		                    </div>
		                </div>
		                
		                <div class="form-group">
		                	<label class="col-sm-2 control-label"></label>
		                    <label class="col-sm-2 control-label"><em>*</em>提成等级：</label>
		                    <div class="col-sm-3">
		                    	<select class="form-control" id="level" name="level" required>
		                    		<option value="0" <#if rebate.level?? && rebate.level==0>selected="selected"</#if>>不提成</option>
									<option value="1" <#if rebate.level?? && rebate.level==1>selected="selected"</#if>>一级提成</option>
									<option value="2" <#if rebate.level?? && rebate.level==2>selected="selected"</#if>>二级提成</option>
									<option value="3" <#if rebate.level?? && rebate.level==3>selected="selected"</#if>>三级提成</option>
		                    	</select>
		                    </div>
		                </div>
		                
		                <hr/>
		                
		                <div id="type_one" <#if rebate.type?? && rebate.type==0>style="display:block;"<#else>style="display:none;"</#if>>
		                	<div class="form-group">
			                	<label class="col-sm-2 control-label"></label>
			                    <label class="col-sm-2 control-label">一级提成：</label>
			                    <div class="col-sm-3">
				                    <div class="input-group">
						            	<input class="form-control" value="${rebate.disposableMoney1?if_exists}" name="disposableMoney1" type="number" min="0"/>
						            	<span class="input-group-addon">元</span>
					                </div>
			                    </div>
			                </div>
			                <div class="form-group">
			                	<label class="col-sm-2 control-label"></label>
			                    <label class="col-sm-2 control-label">二级提成：</label>
			                    <div class="col-sm-3">
				                    <div class="input-group">
						            	<input class="form-control" value="${rebate.disposableMoney2?if_exists}" name="disposableMoney2" type="number" min="0"/>
						            	<span class="input-group-addon">元</span>
					                </div>
			                    </div>
			                </div>
			                <div class="form-group">
			                	<label class="col-sm-2 control-label"></label>
			                    <label class="col-sm-2 control-label">三级提成：</label>
			                    <div class="col-sm-3">
				                    <div class="input-group">
						            	<input class="form-control" value="${rebate.disposableMoney3?if_exists}" name="disposableMoney3" type="number" min="0"/>
						            	<span class="input-group-addon">元</span>
					                </div>
			                    </div>
			                </div>
		                </div>
		                
		                <div id="type_two" <#if rebate.type?? && rebate.type==1>style="display:block;"<#else>style="display:none;"</#if>>
		                	<div class="form-group">
		                	
			                	<h4><label class="col-sm-2 control-label">一级提成</label></h4>
			                	
			                    <label class="col-sm-2 control-label">提成（固定）：</label>
			                    <div class="col-sm-3">
				                    <div class="input-group">
						            	<input class="form-control" value="${rebate.money1?if_exists}" name="money1" type="number" min="0"/>
						            	<span class="input-group-addon">元</span>
					                </div>
			                    </div>
			                </div>
			                <div class="form-group">
			                	<label class="col-sm-2 control-label"></label>
			                    <label class="col-sm-2 control-label">提成（比例）：</label>
			                    <div class="col-sm-3">
				                    <div class="input-group">
						            	<input class="form-control" value="${rebate.commission1?if_exists}" name="commission1" type="number" min="0" max="100"/>
						            	<span class="input-group-addon">%</span>
					                </div>
			                    </div>
			                </div>
			                <div class="form-group">
			                	<label class="col-sm-2 control-label"></label>
			                	<label class="col-sm-2 control-label">提成类型：</label>
		                    	<p class="form-control-static">
			                    	<label style="padding-right:20px;padding-left:15px;">
									  <input type="radio" name="memberRebateType1" value="guding" <#if rebate.memberRebateType1?? && rebate.memberRebateType1=='guding'>checked="checked"</#if> />使用固定提成
									</label>
									<label>
									  <input type="radio" name="memberRebateType1" value="percent" <#if rebate.memberRebateType1?? && rebate.memberRebateType1=='percent'>checked="checked"</#if>/>使用比例提成
									</label>
								</p>
			                </div>
			                <hr/>
			                
			                <div class="form-group">
			                	
			                	<h4><label class="col-sm-2 control-label">二级提成</label></h4>
			                	
			                    <label class="col-sm-2 control-label">提成（固定）：</label>
			                    <div class="col-sm-3">
				                    <div class="input-group">
						            	<input class="form-control" value="${rebate.money2?if_exists}" name="money2" type="number" min="0"/>
						            	<span class="input-group-addon">元</span>
					                </div>
			                    </div>
			                </div>
			                <div class="form-group">
			                	<label class="col-sm-2 control-label"></label>
			                    <label class="col-sm-2 control-label">提成（比例）：</label>
			                    <div class="col-sm-3">
				                    <div class="input-group">
						            	<input class="form-control" value="${rebate.commission2?if_exists}" name="commission2" type="number" min="0" max="100"/>
						            	<span class="input-group-addon">%</span>
					                </div>
			                    </div>
			                </div>
			                <div class="form-group">
			                	<label class="col-sm-2 control-label"></label>
			                	<label class="col-sm-2 control-label">提成类型：</label>
		                    	<p class="form-control-static">
			                    	<label style="padding-right:20px;padding-left:15px;">
									  <input type="radio" name="memberRebateType2" value="guding" <#if rebate.memberRebateType2?? && rebate.memberRebateType2=='guding'>checked="checked"</#if> />使用固定提成
									</label>
									<label>
									  <input type="radio" name="memberRebateType2" value="percent" <#if rebate.memberRebateType2?? && rebate.memberRebateType2=='percent'>checked="checked"</#if>/>使用比例提成
									</label>
								</p>
			                </div>
			                <hr/>
					                
			                <div class="form-group">
			                	
			                	<h4><label class="col-sm-2 control-label">三级提成</label></h4>
			                	
			                    <label class="col-sm-2 control-label">提成（固定）：</label>
			                    <div class="col-sm-3">
				                    <div class="input-group">
						            	<input class="form-control" value="${rebate.money3?if_exists}" name="money3" type="number" min="0"/>
						            	<span class="input-group-addon">元</span>
					                </div>
			                    </div>
			                </div>
			                <div class="form-group">
			                	<label class="col-sm-2 control-label"></label>
			                    <label class="col-sm-2 control-label">提成（比例）：</label>
			                    <div class="col-sm-3">
				                    <div class="input-group">
						            	<input class="form-control" value="${rebate.commission3?if_exists}" name="commission3" type="number" min="0" max="100"/>
						            	<span class="input-group-addon">%</span>
					                </div>
			                    </div>
			                </div>
			                <div class="form-group">
			                	<label class="col-sm-2 control-label"></label>
			                	<label class="col-sm-2 control-label">提成类型：</label>
		                    	<p class="form-control-static">
			                    	<label style="padding-right:20px;padding-left:15px;">
									  <input type="radio" name="memberRebateType3" value="guding" <#if rebate.memberRebateType3?? && rebate.memberRebateType3=='guding'>checked="checked"</#if> />使用固定提成
									</label>
									<label>
									  <input type="radio" name="memberRebateType3" value="percent" <#if rebate.memberRebateType3?? && rebate.memberRebateType3=='percent'>checked="checked"</#if>/>使用比例提成
									</label>
								</p>
			                </div>
		                </div>
		                
				       
		                <div class="form-group" style="margin-left:10px;">
			                <label class="col-sm-5 control-label"></label>
			                <input id="submit_button" type="button" class="btn btn-primary" value="保存">
			            </div>
			            
					</form>
        		</div>
			</div>
		</div>
	</div>

</@override>
<@override name="footer">
<script type="text/javascript">
	$(document).ready(function(){
		$("input[name=type]").change(function(){
			if($(this).val()=="0"){
				$("#type_two").slideUp(300);
				$("#type_one").fadeIn(500);
			}
			else if($(this).val()=="1"){
				$("#type_one").slideUp(300);
				$("#type_two").fadeIn(500);
			}
		});
		
		$("#submit_button").click(function(){
			$.post($("#submit_form").attr("action"),$("#submit_form").serialize(),function(result){
				if(result.success){
					$.scojs_message("修改成功", $.scojs_message.TYPE_OK);
					setTimeout(function(){
		    			window.location.reload(true);
		    		}, 1000);
				}
				else{
					$.scojs_message(result.message, $.scojs_message.TYPE_ERROR);
				}
			});
		});
	});
</script>
</@override>
<@extends name="../layout.ftl"/>